<?php 
		echo $this->Html->script('admin.user');
		$config = Configure::getInstance();
?>
		<div class="pagination">
			<div class="paging">

				<?php 
				if(!$this->Paginator->first()){
				?>
				<span class="arrowBg grayPrevFirst" href="#"></span>
				<?
				}
				echo $this->Paginator->first('<span class="arrowBg yellowPrevFirst"></span>', array('escape'=>false));
										
				if($this->Paginator->hasPrev()){
					echo $this->Paginator->prev('<span class="arrowBg yellowPrev"></span>', array('escape'=>false));
				}
				else{
					echo $this->Paginator->prev('<span class="arrowBg grayPrev"></span>', array('escape'=>false));
				}
				?>
				<?php echo $this->Paginator->numbers();?>
				<?php 
					if($this->Paginator->hasNext()){
					
						echo $this->Paginator->next('<span class="arrowBg yellowNext"></span>', array('escape'=>false));
					}
					else{
						echo $this->Paginator->next('<span class="arrowBg grayNext"></span>', array('escape'=>false));
					}
				if(!$this->Paginator->last()){
				?>
				<span class="arrowBg grayNextFirst"></span>
				<?
				}		
					echo $this->Paginator->last('<span class="arrowBg yellowNextFirst"></span>', array('escape'=>false));
				?>
			</div>
		</div>
		
		
		<div id='togglestatusurl' style="display:none;"><?php  echo $this->webroot."admin/". $this->params['controller'] ."/togglestatus"?></div>
					
		
			<div class="memberEdit">
					<table cellpadding="0" cellspacing="0" border="0" width="100%">
							<tr class="thTableEvenRow">
								<th><?php echo $this->Paginator->sort('Id', 'Buyhistory.id');?></th>
								<th ><?php echo $this->Paginator->sort('Seller', 'Deal.user_id');?></th>
								<th ><?php echo $this->Paginator->sort('Buyer', 'Buyhistory.user_id');?></th>
								<th><?php echo $this->Paginator->sort('Product', 'Product.name');?></th>								
								<th><?php echo $this->Paginator->sort('Price', 'Deal.price');?></th>
								<th width="10%"><?php echo $this->Paginator->sort('Date', 'Buyhistory.created');?></th>
							</tr>
							
							<?php
							if($dataempty){
							?>
								<tr class="altBg">
									<td>No Data Found.</td>
								</tr>
							<?
							}
							$i=1;
							foreach ($sales as $sale):
								if($i%2==0) $class='thTableEvenRow';
								else $class='thTableOddRow';
							?>
							
							<tr class="<?=$class?>">
								<td><?php echo $sale['Buyhistory']['id'];?></td>
								<td><?php echo $all_users[$sale['Deal']['user_id']];?></td>
								<td><?php echo $all_users[$sale['Buyhistory']['user_id']];?></td>
								<td><?php echo $sale['Product']['name'];?></td>
								<td><?php echo $sale['Deal']['price'];?></td>
								<td><?php echo $sale['Buyhistory']['created'];?></td>								
							</tr>
							<?php 
							$i++;
							endforeach; ?>
						</table>
			</div>
			
			
		<div class="pagination">
			<div class="paging">

				<?php 
				if(!$this->Paginator->first()){
				?>
				<span class="arrowBg grayPrevFirst" href="#"></span>
				<?
				}
				echo $this->Paginator->first('<span class="arrowBg yellowPrevFirst"></span>', array('escape'=>false));
										
				if($this->Paginator->hasPrev()){
					echo $this->Paginator->prev('<span class="arrowBg yellowPrev"></span>', array('escape'=>false));
				}
				else{
					echo $this->Paginator->prev('<span class="arrowBg grayPrev"></span>', array('escape'=>false));
				}
				?>
				<?php echo $this->Paginator->numbers();?>
				<?php 
					if($this->Paginator->hasNext()){
					
						echo $this->Paginator->next('<span class="arrowBg yellowNext"></span>', array('escape'=>false));
					}
					else{
						echo $this->Paginator->next('<span class="arrowBg grayNext"></span>', array('escape'=>false));
					}
				if(!$this->Paginator->last()){
				?>
				<span class="arrowBg grayNextFirst"></span>
				<?
				}		
					echo $this->Paginator->last('<span class="arrowBg yellowNextFirst"></span>', array('escape'=>false));
				?>
			</div>
		</div>